﻿<!DOCTYPE html>

<!--培训课程管理-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="/static/js/common.js"></script>
    <link href="../static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="../static/js/vue-treeselect/vue-treeselect.js"></script>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }

        .el-input__suffix {
            /* z-index: 9; */
        }

        .el-form-item__content {
            line-height: 28px !important;
        }
    </style>
</head>

<body>
    
<div id="app" v-cloak>   
        <el-form label-position=" right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
            style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">
                        
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />培训课程管理列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn :text="col.btnAdd" linetype="3" @click="UserInput('tj')"></btn>
                        <btn-export-list url="/api/PX_Course/Export" :forminline="this.formInline" linetype="3"></btn-export-list>
                        <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
                    </span>
                </el-col>
            </el-row>
            <el-row>
                <list-factorys v-model="formInline.model.createFactory" @change="factoryChange"></list-factorys>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.coursewareName"
                                      :placeholder="TrainingCourseManagement.CoursewareName" size="mini">
                                <template slot="prepend">
                                    {{TrainingCourseManagement.CoursewareName+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">

                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingCourseManagement.ClassificationofCourseware+mark.m}}
                                </template>
                                <treeselect v-model="formInline.model.classificationofCourseware"
                                            :options="DepartmentList"
                                            :flat="true"
                                            slot="suffix"
                                            :disable-branch-nodes="true"
                                            style="line-height: 28px;width:70%;float: right;"
                                            placeholder="请选择" />
                            </el-input>

                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.mark01" :placeholder="TrainingCourseManagement.Trainer"
                                      size="mini">
                                <template slot="prepend">
                                    {{TrainingCourseManagement.Trainer+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">

                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{TrainingCourseManagement.Encryptionornot+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.encryptionornot" slot="suffix"
                                           :placeholder="TrainingCourseManagement.Encryptionornot">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in Encryptionornot" :label="item.value" :value="item.key">
                                    </el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>

                    </div>
                </el-col>
            </el-row>
        </el-form>
        <el-col span="24">
            <el-table ref="table" stripe :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight"
                border @selection-change="handleSelectionChange" row-style="height:10px"
                style="width: 100%;height: 100%;">
                <el-table-column type="selection" style="
        padding-top: 0px;
        padding-bottom: 0px;
    " align="center" width="55" :reserve-selection="true">
                </el-table-column>
                <!-- 除第一列以外 遍历所有字段 -->
                <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  下同-->
                <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                    show-overflow-tooltip="true"></el-table-column>
                <el-table-column prop="coursewareName" :label="TrainingCourseManagement.CoursewareName" min-width="150"
                    show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="attachmentName" :label="TrainingCourseManagement.Courseware" min-width="150"
                    show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="mark01"
                    :label="TrainingCourseManagement.ClassificationofCourseware" min-width="150"
                    show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column prop="mark02" :label="TrainingCourseManagement.Trainer" min-width="80"
                    show-overflow-tooltip="true">
                </el-table-column>
                <el-table-column width="100" prop="learningtime" :label="TrainingCourseManagement.Learningtime">
                </el-table-column>
                <el-table-column width="100" prop="encryptionornot"  :label="TrainingCourseManagement.Encryptionornot">
                    
                </el-table-column>
                <el-table-column width="53" :label="col.btnUpdate" fixed="right">
                    <template slot-scope="scope">
                        <button type="button" class="elst-bt-xg" @click="UserInput('xg',scope.row.id)">
                            <i class="el-icon-edit"></i>
                        </button>
                    </template>
                </el-table-column>
            </el-table>
            <el-row type="flex" justify="end">
                <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                    :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                    :layout="ListItem.layout" :total="ListItem.total">
                </el-pagination>
            </el-row>
            <!--user建议替换为表名 需要与resource文件夹下js 中的对象保持一致  -->
            <el-dialog title="培训课程管理" :visible.sync="ListItem.dialogVisible" @close='closeDialog' width="80%"
                height="80%" top="10vh" fullscreen="true">
                <iframe ref="iframe" :src="ListItem.InputUrl" style="height:100%;width:100%" frameborder="0"></iframe>
            </el-dialog>
        </el-col>
        
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                ListItem: ListItem,
                value1: '',
                isShow: true,
                Encryptionornot: [],
                DepartmentList:[],
                formInline: {
                    value1: '',
                    // 遍历所有列 均为字符串即可
                    model: {
                        CoursewareName: '',
                        ClassificationofCourseware:null,
                        Learningtime: '',
                        Encryptionornot: '',
                        Trainer: '',
                        Courseware: '',
                    },
                    offset: 0,
                    limit: 10
                }
            },
            mounted: function () {
           
                this.Encryptionornot = getDicData('是与否');
               
                //初始化数据
                this.GetPageData(1);
                this.GetData();
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },
                closeDialog: function () { closeDialog(this); },
                //Model 替换成 表名
                onDelete: function () { onDelete(this, '/api/PX_Course/DeleteMuti'); },

                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Model 替换成 表名
                UserInput: function (val, id) { DialogShow(this, val, "TrainingCourseManagementInput.html", id); },

                //Model 替换成 表名
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/PX_Course/PCGetList') },

                GetData: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/PX_CourseClass/GetList', this.formInline, function (response) {

                        var data = MenuHelper(response.data.pageData, guidEmpty);
                        mythis.DepartmentList = data;
                        // mythis.DepartmentList.unshift({ id: guidEmpty, label: '无父级', Id: guidEmpty })//初始化无父级的选项
                    }, false);

                },
                onSubmit: function () { onSubmit(this); },

                handleSizeChange: function (val) { handleSizeChange(this, val); },

                handleCurrentChange: function (val) { handleCurrentChange(this, val); },

                handleNodeClick: function (data) {
                    this.formInline.model.Category = data.id;
                    this.GetPageData(1);
                },
                factoryChange: function () {
                    this.GetData();
                    this.GetPageData(1);

                },
            }
        });

        function MenuHelper(list, pid) {
            var result = [];
            list.forEach(function (v, i) {
                if (v.pId == pid) {
                    var obj = v;
                    obj.id = obj.id + '';
                    obj.label = obj.name + '';
                    var nextObj = MenuHelper(list, v.id);
                    if (nextObj.length > 0) {
                        obj.children = nextObj;
                    }
                }
                if (obj)
                    result.push(obj)
            })
            return result;
        }
    </script>

</body>

</html>